<?php
	include "../../public/commom/config.php";
	include "../lock2.php";
	include "../../public/commom/commom.php";
	
	if($_GET) {
		$id = $_GET["id"];
		
		$sql = "SELECT * FROM class where id = $id";
		
		$result = mysqli_query($conn, $sql);
		
		while($row = mysqli_fetch_array($result)) {
			$name = $row["name"];
			$img = $row["img"];
		}
		
		mysqli_close($conn);
	}
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="../public/css/index.css"/>
	</head>
	
	<body>
			<h1>修改分类</h1>
			<form action="modify1.php" method="post" enctype="multipart/form-data">
				<label>
					分类名称：
					<input type="text" name="name" value="<?php echo $name?>" placeholder="请输入分类名称..." autocomplete="off" />
				</label>
				<label>
					上传图片：
					<input type="file" name="img" accept="image/gif, image/jpeg, image/png, image/jpg, image/webp">	
				</label>
				原图
				<img src="<?php echo $imgPathThumb . $img; ?>"/>
				
				<input type="hidden" name="id" value="<?php echo $id?>" />
				<input type="hidden" name="pimg" value="<?php echo $img?>" />
				<input type="submit" value="修改"/>
			</form>
	</body>
	
</html>